<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml"
      xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<h1>这是test.html</h1>
<div>
    <span th:text="${user?.getUsername()}">用户名1</span> | <span th:text="${user?.getUsername()}">用户名2</span>
    | <span th:text="${admin?.username}">EL: admin.username = 空</span>
    | <span th:text="${admin?.username ?: '无名氏'}">是否有amdin变量？</span>
    + <span th:text="${user?.username ?: '无名氏'}"></span>
    
    <span th:if="${admin == null}">空空如也</span>
    <span th:if="${user != null}">大名鼎鼎：<b th:text="${user.username}"></b></span>
    |
    <th:block th:switch="${user?.username}">
        <span th:case="蔡徐">小黑子就是你</span>
        <span th:case="老刘">你就是老刘</span>
        <span th:case="*">默认【用*】</span>
    </th:block>
    |
    <br/>
    <ol>
        <th:block th:each="e,i:${array}">
            <li><span th:text="${i}"></span> = <span th:text="${e}"></span></li>
        </th:block>
    </ol>
    
    <ul>
        <th:block th:each="e,status:${array}">
            <li><span th:text="${status.count}"></span> = <span th:text="${status.current}"></span></li>
        </th:block>
    </ul>
    
    <ul>
        <th:block th:each="e,status:${list}">
            <th:block th:if="${status.even}">
                <li><span th:text="${status.count}"></span> = <span th:text="${status.current}"></span></li>
            </th:block>
        </th:block>
    </ul>
    
    <ul>
        <th:block th:each="kv,status:${map}">
            <th:block th:if="${status.odd}">
                <li th:text="${kv.key} + ' =>' + ${kv.value}"></li>
            </th:block>
        </th:block>
    </ul>
    张飞：<span th:text="${map.name}"></span> | <span th:text="${map['张飞']}"></span>
    <th:block th:each="i:${#numbers.sequence(1,100,5)}">
        <i th:text="${i}"></i>
    </th:block>
    
    <br/>
工具：<b th:text="${#dates.createNow()}"></b> | <b th:text="${#dates.format(#dates.createNow(), 'yyyy/MM/dd')}"></b>
    
    <br/>
    map对象：<span th:text="${map}"></span>
</div>
<hr/>
<div>
    <p>
        EL表达式中，表达式必须写在{}里面：${not empty xxx} | ${1+1}
        <br/>
        Thymeleaf中，表达式在th:xxx="这里就可以写表达式"，th:xxx="1+1"
    </p>
</div>
<div>
    <span th:text="1 + ${'abc'.length()} >= 2 + 3 - ${4 / 5}"></span>
    | <span th:style="${style} + ' border:1px solid red'">这个带style样式</span>
    | <input type="text" th:value="${style}"/>
</div>
<hr/>
<div>
    ${name} = <span th:text="${name}"></span>
    | <span th:text="${name}">这里会被覆盖：${name}</span>
    | <span style="color: red;">我的大名是：<i th:text="${name}">${name}</i></span>
    | <span style="color: blue;">大名：<th:block th:text="${name}"></th:block></span>
    | <span style="color: green;" th:text="${'大名：' + name}"></span>
    | <span style="color: green;" th:text="'大名：' + ${name}"></span>
    | <span th:utext="${name}">这里会被覆盖：${name}</span>
</div>
</body>
</html>